$(function() {
	$('#vue_vm_list_1 table').hide();
	$('#vue_vm_list_2 table').hide();
	$('#vue_vm_list_3 table').hide();
	
	var staffId = getLoginedUser()? getLoginedUser().staffId: '';
	var staffName = getLoginedUser()? getLoginedUser().staffName: '';
	paper_getUserPaper(staffId, staffName, 1);
	paper_getUserPaper(staffId, staffName, 2);
	paper_getUserPaper(staffId, staffName, 3);
});

function paper_getUserPaper(staffId, staffName, paperType) {
	if($('#vue_vm_list_' + paperType).length==0) {return;}
	$('#vue_vm_list_' + paperType + ' table').hide();
	
	find_basic_by_json(path+'/paper/getUserPaper', {staffId: staffId, paperType: paperType}, 
		onSuccess=function(response) {	
			new Vue({
				el: '#vue_vm_list_' + paperType,
				data: {
					todos: response.data
				},
				methods: {
					openPrintEdit:function() {
						openPrintEdit(staffId, staffName, paperType);
					}
				}
			});
			
			$('#vue_vm_list_' + paperType + ' table').show();
		},
		onEmpty=function(response) {
			new Vue({
				el: '#vue_vm_list_' + paperType,
				data: {
					todos: response.data
				},
				methods: {
					openPrintEdit:function() {
						openPrintEdit(staffId, staffName, paperType);
					}
				}
			});
			
			$('#vue_vm_list_' + paperType + ' table').show();
		}
	);
}

function openPrintEdit(staffId, staffName, paperType) {
	var pageParam = {};
	pageParam.staffId = staffId;
	pageParam.staffName = staffName;
	pageParam.paperType = paperType;
	window.open('0_print_pj_edit.html?pageParam='+encodeURIComponent(JSON.stringify(pageParam)));
}